package com.zyf.chapter01.principle.DRY;

/**
 * 用户服务类
 * @author yifeng
 */
public class UserService {
    private UserRepo userRepo; // 通过依赖注入 或者 IOC 框架注入

    public User login(String email, String password) {
        boolean existed = userRepo.checkIfUserExisted(email, password);
        if (!existed) {
            // ... throw InvalidUsernameException ...
        }
        User user = userRepo.getUserByEmail(email);
        return user;
    }
}
